﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Xiaov.SmartWeb.Application.TZGC.GCLB
{
    public partial class GclbglData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string gcmc = "", gczt = "", gclb = "", sql = "";
                if (Request.QueryString["gcmc"] != null && Request.QueryString["gcmc"].ToString() != "")
                {
                    gcmc = Request.QueryString["gcmc"].ToString();
                }
                if (Request.QueryString["gczt"] != null && Request.QueryString["gczt"].ToString() != "")
                {
                    gczt = Request.QueryString["gczt"].ToString();
                }
                if (Request.QueryString["gclb"] != null && Request.QueryString["gclb"].ToString() != "")
                {
                    gclb = Request.QueryString["gclb"].ToString();
                }
                sql = "select * from yt_gcb ";
                if (gczt == "")
                {
                    sql += " where gclb='" + gclb + "' ";
                }
                else
                {
                    sql += " where gclb<>'" + gclb + "' ";
                    if (gcmc != "")
                    {
                        sql += " and gcmc like '%" + gcmc + "%'";  
                    }
                    if (gczt != "" && gczt != "all")
                    {
                        sql += " and wczt=" + gczt;
                    }
                }
                DataSet ds = Maticsoft.DBUtility.DbHelperOra.Query(sql);
                Xiaov.SmartWeb.Application.SupCan.ConvertToXml.Convert(ds.Tables[0], "gcid,gcmc", 0, ds.Tables[0].Rows.Count);
            }
        }
    }
}